@extends('admin')

@section('content')

    <div class="nav">
        <ul class="cc">
            <li class="current">
                <a href="{{url('admin/areas')}}">城市管理</a>
            </li>
            <li>
                <a href="{{url('admin/areas/district')}}">商圈管理</a>
            </li>
        </ul>
    </div>

    <p class="mb10">
        <a href="{{url('admin/areas/update')}}" class="btn J_dialog" title="新增城市"><span class="add"></span>新增城市</a>
    </p>

    <div class="h_a">搜索</div>
    <div class="search_type cc mb10">
        <form action="{{url('admin/areas/')}}" method="get" class="search_form">
            <label for="parent_id">按省份：</label>
            <select name="parent_id" id="parent_id" class="mr10">
                <option value="">全部</option>
                @foreach ($provinces as $province)
                    <option @if ($parent_id == $province->id) selected="selected" @endif value="{{$province->id}}">{{$province->name}}</option>
                @endforeach
            </select>
            <label for="search_name">名称：</label><input type="text" name="name" value="{{$name}}" id="search_name" class="input length_2"/>
            <button type="submit" class="btn">提交查询</button>
        </form>

    </div>

    <div class="table_list">
        <div id="data_list">
            <table class="items">
                <thead>
                <tr>
                    <th>ID</th>
                    <th>名称</th>
                    <th>首字母</th>
                    <th>上级</th>
                    <th>是否热门</th>
                    <th>状态</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                @foreach ($list as $item)
                    <tr>
                        <td>{{$item->id}}</td>
                        <td>{{$item->name}}</td>
                        <td>{{$item->fletter}}</td>
                        <td>@if ($item->parent) {{$item->parent->name}} @else 顶级 @endif</td>
                        <td>@if ($item->is_hot) <span class="green">是</span> @else <span class="red">否</span> @endif</td>
                        <td>@if ($item->status) <span class="green">启用</span> @else <span class="red">禁用</span> @endif</td>
                        <td>
                            <a href="{{url('admin/areas/update/'.$item->id)}}" title="编辑{{$item->name}}" class="mr10 J_dialog">[编辑]</a>
                        </td>
                    </tr>
                @endforeach
                </tbody>
            </table>
        </div>

        <div class="summary">
            共有 {{$list->total()}} 条数据
        </div>
        @if ($list->hasPages())
        <div class="pager">
            <!--
            <span style="float:left; margin-right:10px;">
                转至<input type="text" id="goToPage" class="input" style="width:30px; text-align:center;">页
                <span onclick="goto();" class="btn btn_submit">跳转</span>
            </span>
            -->
            {!! $list->appends($appends)->render() !!}
        </div>
        @endif
    </div>

@stop